package com.css.bjdt_report.util;

public class ReportConstant {
	//------------------------------------------------------------行列条件------------------------------------------------------------
	//暂时只支持计数
	public static final String PK = "1";
	public static final String FK = "2";
	public static final int STRING = 1;
	public static final int NUMBER = 2;
	public static final int DATE = 3;
	public static final int PROTOTYPE = 4;
	public static final String MASTER_TABLE = "$masterTable$";
	public static final String SUB_TABLE = "$subTable$";
	public static final String MASTER_TABLE_COLUMN = "$masterTableColumn$";
	public static final String SUB_TABLE_COLUMN = "$subTableColumn$";
	public static final String LEFT = "$left$";
	public static final String RIGHT = "$right$";
	public static final String LOGIC_OPERATOR = "$logicOperator$";
	public static final String CONDITION_VAL = "@conditionVal";
	public static final String UNIT_CONDITION_VAL = "@unitConditionVal";
	public static final String START_TIME_CONDITION_VAL = "to_date(@startTimeConditionVal,'yyyy/MM/dd')";
	public static final String END_TIME_CONDITION_VAL = "to_date(@endTimeConditionVal,'yyyy/MM/dd')";
	public static final String RELA_OPERATOR = "$relaOperator$";
	public static final String WHERE_KEY = " where ";
	public static final String AND_KEY = "and ";
	public static final String BASE_SQL = "select count(1) from $masterTable$";
	public static final String JOIN_SQL = " inner join $subTable$ on $subTable$.$subTableColumn$ = $masterTable$.$masterTableColumn$ ";
	public static final String WHERE_SQL = "$left$$masterTable$.$masterTableColumn$ $relaOperator$ @conditionVal $right$$logicOperator$ ";
	//------------------------------------------------------------行列计算------------------------------------------------------------
	public static final String OPERATOR_ARITH = "[\\+\\-\\*/]";
	public static final String OPERATOR_RELA = "[><!=]=?|=";
	public static final String ROW_ZH_CN = "行";
	public static final String COL_ZH_CN = "列";
	public static final String SPLIT_OPERATOR = "_";
	//------------------------------------------------------------指标取值------------------------------------------------------------
	public static final String EXECUTIVE_TABLE_PREFIX = "RPT_CELL_DATA_";
	public static final String ISEXIST_TABLE_SQL = "select count(1) from user_all_tables where table_name = @table_name";
	public static final String EXECUTIVE_CREATE_TABLE_SQL = "create table $table_name (CELL_DATA_ID VARCHAR2(50) not null,CELL_ID VARCHAR2(50),CELL_VALUE VARCHAR2(50),BATCH_ID VARCHAR2(50),ABS_ROW_NUM VARCHAR2(50),ABS_COL_NUM VARCHAR2(50),REL_ROW_NUM VARCHAR2(50),REL_COL_NUM VARCHAR2(50),DZZ_ID VARCHAR2(50))";
	public static final String EXECUTIVE_INSERT_SQL = "INSERT INTO $table_name (CELL_DATA_ID,CELL_ID,CELL_VALUE,BATCH_ID,ABS_ROW_NUM,ABS_COL_NUM,REL_ROW_NUM,REL_COL_NUM,DZZ_ID) VALUES(@CELL_DATA_ID,@CELL_ID,@CELL_VALUE,@BATCH_ID,@ABS_ROW_NUM,@ABS_COL_NUM,@REL_ROW_NUM,@REL_COL_NUM,@DZZ_ID)";
	public static final String EXECUTIVE_DELETE_SQL = "delete from $table_name where DZZ_ID = @dzz_id";
	public static final String EXECUTIVE_DELETE_SQL_BY_BATCHID = "delete from $table_name where BATCH_ID = @batch_id";
	public static final String EXECUTIVE_DELETE_SQL_BY_CELLTYPE = "delete from $table_name where cell_id in (select cell_id from RPT_CELL where cell_type in ('1','3','5')) and DZZ_ID = @dzz_id";
	public static final String EXECUTIVE_QUERY_SQL = "select CELL_DATA_ID,CELL_ID,CELL_VALUE,BATCH_ID,ABS_ROW_NUM,ABS_COL_NUM,REL_ROW_NUM,REL_COL_NUM,DZZ_ID from $table_name where DZZ_ID = @dzz_id";
	public static final String EXECUTIVE_QUERY_CELL_SQL = "select CELL_DATA_ID,CELL_ID,CELL_VALUE,BATCH_ID,ABS_ROW_NUM,ABS_COL_NUM,REL_ROW_NUM,REL_COL_NUM from $table_name cd where cd.CELL_ID in (@cellIds) and cd.DZZ_ID = @dzz_id";
	public static final String EXECUTIVE_SUM_CELL_SQL = "select sum(cell_value) from $tableName cd where cd.DZZ_ID in (@dzzIds) and cd.CELL_ID = @cellId";
	public static final String TO_DATE_FUN = "to_date('@conditionVal','yyyy/MM/dd')";
	//------------------------------------------------------------数据校核------------------------------------------------------------
	public static final String VALIDATION_TABLE_PREFIX = "RPT_VALI_INFO_";
	public static final String VALIDATION_CREATE_TABLE_SQL = "create table $table_name (ID VARCHAR2(50) not null,BATCH_ID VARCHAR2(50),SOURCE_EXP VARCHAR2(2000),CELL_EXP VARCHAR2(2000),ACTUAL_EXP VARCHAR2(500),VALIDATION_TYPE VARCHAR2(500),VALIDATION_STATE VARCHAR2(50),CELL_ID VARCHAR2(50),DZZ_ID VARCHAR2(50))";
	public static final String VALIDATION_INSERT_SQL = "INSERT INTO $table_name (ID,BATCH_ID,SOURCE_EXP,CELL_EXP,ACTUAL_EXP,VALIDATION_TYPE,VALIDATION_STATE,CELL_ID,DZZ_ID) VALUES(@ID,@BATCH_ID,@SOURCE_EXP,@CELL_EXP,@ACTUAL_EXP,@VALIDATION_TYPE,@VALIDATION_STATE,@CELL_ID,@DZZ_ID)";
	public static final String VALIDATION_DELETE_SQL = "delete from $table_name where DZZ_ID = @dzz_id";
	public static final String VALIDATION_QUERY_SQL = "select ID,BATCH_ID,SOURCE_EXP,CELL_EXP,ACTUAL_EXP,VALIDATION_TYPE,VALIDATION_STATE,CELL_ID,DZZ_ID from $table_name where DZZ_ID = @dzz_id order by VALIDATION_TYPE asc";
	//------------------------------------------------------------报表批注------------------------------------------------------------
	public static final String COMMENT_TABLE_PREFIX = "RPT_CELL_COMM_";
	public static final String COMMENT_CREATE_TABLE_SQL = "create table $table_name (ID VARCHAR2(50) not null,TEMPLATE_DATA_ID VARCHAR2(50),ABS_ROW_NUM VARCHAR2(10),ABS_COL_NUM VARCHAR2(10),TEMPLATE_COMMENT VARCHAR2(500))";
	public static final String COMMENT_INSERT_SQL = "INSERT INTO $table_name (ID,TEMPLATE_DATA_ID,ABS_ROW_NUM,ABS_COL_NUM,TEMPLATE_COMMENT) VALUES(@ID,@TEMPLATE_DATA_ID,@ABS_ROW_NUM,@ABS_COL_NUM,@TEMPLATE_COMMENT)";
	public static final String COMMENT_DELETE_SQL = "delete from $table_name where TEMPLATE_DATA_ID = @templateDataId";
	public static final String COMMENT_QUERY_SQL = "select ID,TEMPLATE_DATA_ID,ABS_ROW_NUM,ABS_COL_NUM,TEMPLATE_COMMENT from $table_name where TEMPLATE_DATA_ID = @templateDataId";
	//------------------------------------------------------------报表审核------------------------------------------------------------
	public static final String EXAMINE_TABLE_PREFIX = "RPT_CELL_EXAM_";
	public static final String EXAMINE_CREATE_TABLE_SQL = "create table $table_name (ID VARCHAR2(50) not null,CELL_ID VARCHAR2(50),TEMPLATE_ID VARCHAR2(50),ERROR_TYPE VARCHAR2(10),EXAMINE_INFO VARCHAR2(1000),EXAMINE_UNIT_ID VARCHAR2(50),EXAMINE_TIME DATE,TEMPLATE_DATA_ID VARCHAR2(50),ABS_ROW_NUM VARCHAR2(10),ABS_COL_NUM VARCHAR2(10))";
	public static final String EXAMINE_INSERT_SQL = "INSERT INTO $table_name (ID,CELL_ID,TEMPLATE_ID,ERROR_TYPE,EXAMINE_INFO,EXAMINE_UNIT_ID,EXAMINE_TIME,TEMPLATE_DATA_ID,ABS_ROW_NUM,ABS_COL_NUM) VALUES(@ID,@CELL_ID,@TEMPLATE_ID,@ERROR_TYPE,@EXAMINE_INFO,@EXAMINE_UNIT_ID,sysdate,@TEMPLATE_DATA_ID,@ABS_ROW_NUM,@ABS_COL_NUM)";
	public static final String EXAMINE_DELETE_SQL = "delete from $table_name where ID = @ID";
	public static final String EXAMINE_QUERY_SQL = "select ID,CELL_ID,TEMPLATE_ID,ERROR_TYPE,EXAMINE_INFO,EXAMINE_UNIT_ID,EXAMINE_TIME,TEMPLATE_DATA_ID,ABS_ROW_NUM,ABS_COL_NUM from $table_name where TEMPLATE_DATA_ID = @templateDataId";
	public static final String EXAMINE_QUERY_CELL_SQL = "select ID,CELL_ID,TEMPLATE_ID,ERROR_TYPE,EXAMINE_INFO,EXAMINE_UNIT_ID,to_char(EXAMINE_TIME,'YYYY-MM-DD HH24:MI:SS') as EXAMINE_TIME,TEMPLATE_DATA_ID,ABS_ROW_NUM,ABS_COL_NUM from $table_name where TEMPLATE_DATA_ID = @templateDataId and ABS_ROW_NUM = @absRowNum and ABS_COL_NUM = @absColNum order by EXAMINE_TIME desc";

}
